<?php
class apiactionlog_ctl_system_store extends desktop_controller{
    var $workground = "apiactionlog.wrokground.store";
    function index(){
        $base_filter = '';
        $actions[] =
            array(
                'label' => '新增',
                'href' => 'index.php?app=apiactionlog&ctl=system_store&act=to_add',
                'target'=>'dialog::{title:\''.app::get('b2c')->_('新增门店').'\',width:460,height:460}',
            );
        $params = array(
            'title'=>'门店设置',
            'actions'=> $actions,
        );

        if($base_filter){
            $params['base_filter'] = $base_filter;
        }

        $this->finder('apiactionlog_mdl_store',$params);
    }

    function to_add(){
        if($_GET['id']){
            $this->pagedata['id'] = $_GET['id'];
        }
        $this->display('system/store.html'); 
    }
    function edit(){
        $this->begin();
        if($_POST['id']){
            $data['id'] = $_POST['id'];
        }
        $data['store_name'] = $_POST['store_name'];
        $stObj = app::get('apiactionlog')->model('store');
        $stObj->save($data);
        $this->end(true, app::get('aftersales')->_('成功'));
    }
}
